package com.malty.mall.domain.entity.ums;


import com.malty.mall.domain.dto.req.UmsResourceParam;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.beans.BeanUtils;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * @author malty
 */
@Data
@NoArgsConstructor
public class UmsResource {
    private Integer id;
    private String name;
    private String path;
    private String note;
    private Integer typeId;
    private Date createTime;
    private Date updateTime;

    public UmsResource(UmsResourceParam umsResourceParam) {
        BeanUtils.copyProperties(umsResourceParam, this);
    }
    public static List<UmsResourceParam> getParamBatch(List<UmsResource> umsResources) {
        List<UmsResourceParam> umsResourceParams = new ArrayList<>();
        for (UmsResource umsResource : umsResources) {
            umsResourceParams.add(new UmsResourceParam(umsResource));
        }
        return umsResourceParams;
    }
}
